#ifndef _STRING_H
#define _STRING_H

#include <algorithm>
#include <iostream>
#include "Vec.h"

//TODO
#include "string.h"
class Str {
public:
	typedef Vec<char>::size_type size_type;

    Str(){}
    Str(size_type n, char c) : data(n, c) {}
    Str(const char* cp) {
        std::copy(cp, cp + strlen(cp), std::back_inserter(data));
    }
    template <class In>
    Str(In b, In e) { 
        std::copy(b, e, std::back_inserter(data));
    }
    Str(const Str& s) : data(s.data) {}
	
    char &operator[](size_type i) { return data[i]; }
    const char &operator[](size_type i) const { return data[i]; }
    size_type size() const { return data.size(); }
    friend std::istream& operator>>(std::istream&, Str&);
	friend std::ostream& operator<<(std::ostream&, const Str&);
    Str &operator+=(const Str&);
    friend Str operator+(const Str&, const Str&);
    Str &operator=(const Str& s) {
        if (this != &s) {
            data = s.data;
        }
        return *this;
    }
private:
    Vec<char> data;
};

#endif
